<template>
 
    <el-table
    :data="orderData"
    border
    style="width: 100%">

    
    <el-table-column
      prop="orderFormNo"
      label="订单编号"
      width="170">
    </el-table-column>


    <el-table-column
      prop="orderFormDestination"
      label="目的地"
      width="70px">
    </el-table-column>

    <el-table-column
      prop="orderFormOrigin"
      label="出发地"
      width="70px">
    </el-table-column>

    <el-table-column
      prop="orderFormPeopleNum"
      label="人数"
      width="50px">
    </el-table-column>

    <el-table-column
      prop="orderFormBudget"
      label="预算"
      width="90px">
    </el-table-column>

    <el-table-column
      prop="orderFormTime"
      label="计划天数"
      width="90px">
    </el-table-column>

    <el-table-column
      prop="orderFormDate"
      label="出行日期"
      width="120px">
    </el-table-column>

    <el-table-column
      prop="orderFormDesc"
      label="个性化需求"
      width="390px">
    </el-table-column>

    <el-table-column label="操作">
      <template slot-scope="scope">
        <el-button
        v-model="orderFormNo"
        type="warning"
          size="mini"
          @click="apply(scope.row.orderFormNo)">申请接单</el-button>
      </template>
    </el-table-column>

</el-table>

</template>

<script>
 export default {
    data() {
      return {
        orderFormNo:'',
        orderFormState:0,
       in:{ 
        orderFormNo:'',
        orderFormState:''
      },  
        customizationStaffId:1319,
        orderData: {
          
    },
        order:[

        ]
      }
    },
    methods: {
      apply(orderFormNo){
      
        this.in.orderFormNo = orderFormNo;
        this.in.customizationStaffId = this.customizationStaffId
       
        this.$axios.put("/orders/addTo",this.in).then((response) =>{
          if (response.data.code == 200) {
          this.$message.success(response.data.message);
          }else{
            this.$message.error("接单失败！");
          }
          this.loadOrders();
        });
      },
      loadOrders(){
          this.$axios.get("/orders/"+this.orderFormState).then(responser=> {
              this.orderData = responser.data.data.orderData
          })
         
         
      },
      handleEdit(index, row) {
        console.log(index, row);
      }
    },
    mounted(){
        this.loadOrders();
        
      }
  }
</script>